//
//  GBJyesbuyViewController.m
//  WortyBuy
//
//  Created by Qianfeng on 16/5/30.
//  Copyright © 2016年 olc. All rights reserved.
//

#import "GBJyesbuyViewController.h"
#import "ZJScrollPageView.h"
#import "GBJfirstViewController.h"
#import "GBJdomesticViewController.h"
#import "GBJseastirkeViewController.h"
#import "GBJstrikeViewController.h"
#import "GBJmassTestViewController.h"
#import "GBJinformationViewController.h"

@interface GBJyesbuyViewController ()

@end

@implementation GBJyesbuyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    ZJSegmentStyle *style = [[ZJSegmentStyle alloc]init];
    style.showCover = YES;
//    style.scrollTitle = NO;
    style.gradualChangeTitleColor = YES;
    style.showExtraButton = YES;
    style.extraBtnBackgroundImageName = @"extraBtnBackgroundImage";
    NSArray *childVcs = [NSArray arrayWithArray:[self setupChildAndTitle]];
    ZJScrollPageView *scrollPageView = [[ZJScrollPageView alloc]initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, self.view.bounds.size.height - 64) segmentStyle:style childVcs:childVcs parentViewController:self];
    __weak typeof (self) weakSelf = self;
    scrollPageView.extraBtnOnClick = ^(UIButton *extraBtn){
        weakSelf.title = @"点击了extraBtn";
        NSLog(@"点击了extraBtn");
        
    };
    [self.view addSubview:scrollPageView];
    
}

- (NSArray *)setupChildAndTitle{
    GBJfirstViewController *vc1 = [GBJfirstViewController new];
    vc1.view.backgroundColor = [UIColor colorWithRed:56 green:89 blue:122 alpha:1.0];
    vc1.title = @"首页";
    
    GBJdomesticViewController *vc2 = [GBJdomesticViewController new];
    vc2.view.backgroundColor = [UIColor yellowColor];
    vc2.title = @"国内";
    
    GBJseastirkeViewController *vc3 = [GBJseastirkeViewController new];
    vc3.view.backgroundColor = [UIColor blueColor];
    vc3.title = @"海淘";
    
    GBJstrikeViewController *vc4 = [GBJstrikeViewController new];
    vc4.view.backgroundColor = [UIColor orangeColor];
    vc4.title = @"原创";
    
    GBJmassTestViewController *vc5 = [GBJmassTestViewController new];
    vc5.view.backgroundColor = [UIColor brownColor];
    vc5.title = @"众测";
    
    GBJinformationViewController *vc6 = [GBJinformationViewController new];
    vc6.view.backgroundColor = [UIColor brownColor];
    vc6.title = @"资讯";
    
    NSArray *childVcs = [NSArray arrayWithObjects:vc1,vc2,vc3,vc4,vc5,vc6,nil];
    return childVcs;
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
